#ifndef STATEMANAGER_H_INCLUDED
#define STATEMANAGER_H_INCLUDED

#include "XGE_Common.h"
#include "IManager.h"
#include "Manager.h"
#include "State.h"

namespace XGE
{
    class StateManager: public XGE::Manager<State>, public XGE::IManager
    {
        protected:
            XGE::State* prevState;
            XGE::State* currState;
            XGE::State* nextState;

        public:
            StateManager(const Ogre::String& nName) : Manager<XGE::State>(nName), IManager(strName)
            {
                prevState = 0;
                currState = 0;
                nextState = 0;
            };

            ~StateManager()
            {
                prevState = 0;
                currState = 0;
                nextState = 0;

                delete prevState;
                delete currState;
                delete nextState;
            };

            //Manager initialisation
            virtual bool init(void);
            //Update
            virtual bool _update(void);
            //Set Next State
            bool setNextState(const Ogre::String& nStateName);
            //Gets the name of the previous State
            Ogre::String getPreviousState(void);
            //Gets the name of the current State
            Ogre::String getCurrentState(void);
            //Gets the name of the next State
            Ogre::String getNextState(void);
            //Loads the next state
            void _loadNextState(void);
    };
}

#endif // STATEMANAGER_H_INCLUDED
